<template>
  <div>
    <h2>各地市场报价</h2>
    <div v-if="market != ''">
      <div v-for="(data, index) in market" :key="index">
        <div class="row gx-2 gx-lg-3">
          <div class="col-sm-6 col-lg-4 mb-3 mb-lg-5">
            <h1>
              <span class="badge bg-success">
                价格：{{ data.split(",")[0] }}
              </span>
            </h1>
          </div>
          <div class="col-sm-6 col-lg-6 mb-3 mb-lg-5">
            <h1>
              <span class="badge bg-primary">市场： </span
              >{{ data.split(",")[1] }}
            </h1>
          </div>
        </div>
      </div>
    </div>
    <div v-if="market == ''"><h1>暂无数据</h1></div>


    
  </div>
</template>

<script>
export default {
  data() {
    return {
      market: "",
    };
  },
  props: ["cate"],
  mounted() {
    this.axios
      .get(
        "http://localhost:8081/api-service/getNywProductsInfoByCateDate?key=123456&cate=" +
          this.cate
      )
      .then((body) => {
        this.data = body.data.data.result;
        this.market = this.data[0].marketPrice;

        this.market = this.market.substr(1, this.market.length - 2);
        this.market = this.market.split(") (");
      });
  },
};
</script>

<style scoped>
@import url("../../../static/css/theme-min.css");
</style>
